<!--结算支付单-->
<template>
  <div>
    <f-search-form ref='search' :more='true' @searchHandler='searchHandler' @exportHandler='exportHandler' :show-export-btn='true'>
      <f-search-form-item label='单号' name='paymentNo' />
      <f-search-form-item label='业务员' name='saleManName' />
      <f-search-form-item label='结算日期' type='range' name='beginDate' />
    </f-search-form>
    <f-table ref='table' rowKey='paymentId' :showSetting='false' setting-key='settle_tab2' :tableColumns='columns' :scroll='{x:true}' handler='settlePayTab2PageListHandler' :showMultipleBtn='false' :operator='operator' :multiple='multiple' :params='queryParam' :api='api.payment'>
        <span slot='paymentState' slot-scope='text, record, index'>
            <a-tag color='#87d068' v-if='text==0'>未提交</a-tag>
            <a-tag color='#108ee9' v-if='text==1' @click='processImg(record)'>{{ record.taskName }}</a-tag>
            <a-tag color='#EE4B2B' v-if='text==2'>已审批</a-tag>
        </span>
        <span slot='drugType' slot-scope='text, record, index'>
          <a-tag color='#87d068' v-if='text=="ZS"'>招商</a-tag>
          <a-tag color='#108ee9' v-if='text=="ZY"'>自营</a-tag>
        </span>
        <span slot='settleType' slot-scope='text, record, index'>
            <a-tag color='#87d068' v-if='text==1'>渠道商</a-tag>
            <a-tag color='#108ee9' v-if='text==2'>商务经理</a-tag>
            <a-tag color='#108ee9' v-if='text==3'>片区服务商</a-tag>
            <a-tag color='#108ee9' v-if='text==4'>商务负责人</a-tag>
        </span>
      <span slot='action' slot-scope='text, record'>
          <template>
            <a @click='startProcess(record.paymentId,"hySettlePayStartProcessHandler")' v-if='record.paymentState==0'>提交</a>
            <a @click='completeTask(record)' v-if="record.taskDefinitionKey&&record.taskDefinitionKey=='__initiator__'">重新提交</a>
            <a-divider type='vertical' v-if='record.paymentState==0 || record.taskDefinitionKey=="__initiator__"' />
            <a @click='$refs.payDetailsDrawer.showDrawer(record)'>明细</a>
            <a-divider type='vertical' />
            <a-dropdown>
             <a class='ant-dropdown-link'>更多<a-icon type='down' /></a>
             <a-menu slot='overlay'>
               <a-menu-item v-if='record.paymentState!=0'>
                  <a href='javascript:;' @click='processImg(record)'>审批进度</a>
               </a-menu-item>
               <a-menu-item>
                  <a href='javascript:;' @click='printOrder(record)'>资金支付单</a>
               </a-menu-item>
               <a-menu-item v-if="record.paymentState==0||record.taskDefinitionKey=='__initiator__'">
                  <a href='javascript:;' @click="$refs.table.del(record,{handlerName:'hySettlePayPaymentDeleteHandler'})">删除</a>
               </a-menu-item>
             </a-menu>
            </a-dropdown>
          </template>
        </span>
    </f-table>
    <pay-details-drawer ref='payDetailsDrawer' @success='onLoad'></pay-details-drawer>
    <print-modal ref='printModal'></print-modal>
    <process-image ref='processImg' v-if='processImageVisible' :visible.sync='processImageVisible' :processInstanceId='processInstanceId'></process-image>
  </div>
</template>
<script>
import api from "../../js/api"

import ProcessImage from "../../../flowable/process/process_image"
import { processMixins } from "@/core/mixins/processMixins"
import PayDetailsDrawer from "./pay/pay_details_drawer"
import PrintModal from "@/views/module/haiying/print/print_modal"

export default {
  name: "Tab2",
  components: { PrintModal, PayDetailsDrawer, ProcessImage },
  mixins: [processMixins],
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {
        fileName:"结算支付明细"
      },
      processImageVisible: false,
      processInstanceId: null,
      params1: {
        deptId: ""
      },
      columns: [
        {
          title: "序号",
          width: "60px",
          align: "center",
          fixed: "left",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "申请日期",
          align: "center",
          sorter: true,
          fixed: "left",
          width: "80px",
          dataIndex: "amountDate"
        },
        {
          title: "支付单号",
          align: "center",
          fixed: "left",
          dataIndex: "paymentNo"
        },
        {
          title: "结算范围",
          align: "center",
          width: "60px",
          dataIndex: "settleType",
          scopedSlots: { customRender: "settleType" }
        },
        {
          title: "业务类型",
          align: "center",
          width: "80px",
          dataIndex: "drugType",
          scopedSlots: { customRender: "drugType" }
        },
        {
          title: "部门",
          align: "left",
          sorter: true,
          width: "80px",
          dataIndex: "deptName"
        },
        {
          title: "业务员",
          align: "left",
          sorter: true,
          width: "80px",
          dataIndex: "saleManName"
        },
        {
          title: "业务编码",
          sorter: true,
          align: "left",
          width: "80px",
          dataIndex: "saleManBusinessNo"
        },
        {
          title: "结算金额",
          align: "left",
          type: 10,
          width: "80px",
          dataIndex: "amount"
        },
        {
          title: "收票单位",
          align: "left",
          width: "180px",
          ellipsis: true,
          dataIndex: "companyName"
        },
        {
          title: "开票单位",
          align: "left",
          ellipsis: true,
          width: "180px",
          dataIndex: "payeeName"
        },
        {
          title: "发票项目",
          align: "left",
          ellipsis: true,
          width: "100px",
          dataIndex: "title"
        },
        {
          title: "发票类型",
          align: "center",
          width: "80px",
          dataIndex: "invoiceType",
          scopedSlots: { customRender: "invoiceType" }
        },
        {
          title: "开票金额",
          align: "left",
          needTotal: true,
          width: "80px",
          type: 10,
          dataIndex: "invoiceAmount"
        },
        {
          title: "不含税金额",
          align: "left",
          width: "90px",
          type: 10,
          needTotal: true,
          dataIndex: "noTaxAmount"
        },
        {
          title: "税费",
          align: "left",
          width: "80px",
          needTotal: true,
          type: 10,
          dataIndex: "taxAmount"
        },
        {
          title: "3%开票金额",
          align: "left",
          needTotal: true,
          width: "100px",
          type: 10,
          dataIndex: "senondInvoiceAmount"
        },
        {
          title: "3%开票税金",
          align: "left",
          width: "100px",
          needTotal: true,
          type: 10,
          dataIndex: "secondTaxAmount"
        },
        {
          title: "申请人",
          align: "center",
          width: "110px",
          dataIndex: "nickName"
        },
        {
          title: "备注",
          align: "center",
          width: "120px",
          dataIndex: "remark"
        }, {
          title: "创建日期",
          align: "center",
          width: "120px",
          dataIndex: "createTime"
        }, {
          title: "状态",
          align: "left",
          dataIndex: "paymentState",
          fixed: "right",
          scopedSlots: { customRender: "paymentState" }
        }, {
          title: "操作",
          align: "center",
          dataIndex: "action",
          fixed: "right",
          width: "80px",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    setData() {
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },
    printOrder(record) {
      this.$refs["printModal"].open(record.paymentId, 7, "Settle")
    },
    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs.table.refresh()
      this.$emit("changeTab")
    },
    processImg(order) {
      this.processInstanceId = order.processInstanceId
      this.processImageVisible = true
    }
  }
}
</script>
supplierBondState